package tema4_Observer2;

import java.util.Iterator;

public class Salariat implements Subiect{
	
	float salary;
	
	public float getSalary() {
		return salary;
	}
	public void setSalary(float salary) {
		this.salary = salary;
	}

	@SuppressWarnings({ "unchecked", "static-access" })
	public void atasareO(Manager s)
	{
		if(!this.observatori.contains(s))
		{
			this.observatori.add(s);
		}
	}
	@SuppressWarnings("static-access")
	public void stergeO(Manager s)
	{
		this.observatori.remove(s);
	}
	@SuppressWarnings({ "static-access", "rawtypes" })
	public void notify2(float newSalary)
	{
		salary=newSalary;
		Iterator el= this.observatori.iterator();
		while(el.hasNext())
		{	
			//((Salariat)el.next()).setSalary(new Float(salary));
			((Manager)el.next()).update();
		}
	}
}
